import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';
import routes from './routers'

// const base = '/my_frame_project/';//应用的基础请求路径

const router = createRouter({
    history: createWebHistory("/"), //history模式使用HTML5模式
    routes
});

router.beforeEach((to, from, next) => {
    if (to.matched.length === 0) { // 如果未匹配到路由
        next('/404')
    } else {
        next() // 如果匹配到正确跳转
    }

})


export default router;
